package system.common;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * <pre>
 * Class : system.common.ApplicationContextBean / ApplicationContextBean.java
 * 	Define Class Object : 
 * <br>
 * </pre>
 * @author hwanLee / apexcns,Inc.
 * @version 1.0
 * @see javadoc
 * @since 2012. 9. 12.
 */
public class ApplicationContextBean {
	private static ApplicationContextBean bean = new ApplicationContextBean();

	private ApplicationContext ctx;

	public static ApplicationContextBean getInstance() {
		return bean;
	}

	private ApplicationContextBean() {
		init();
	}

	public Object getBean(String beanName) {
		return ctx.getBean(beanName);
	}

	private void init() {
		ctx = new ClassPathXmlApplicationContext(getContextPaths());
	}

	private String[] getContextPaths() {
		String dir = "config/";
		String[] paths = { dir + "applicationContext.xml" };

		return paths;
	}
}
